package com.yiren.manager.service.impl.pension;

import javax.transaction.Transactional;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.yiren.core.exception.MyException;
import com.yiren.core.service.GenericServiceImpl;
import com.yiren.core.utils.Favorites;
import com.yiren.entity.YrNursingCost;
import com.yiren.entity.YrNursingCostHistory;
import com.yiren.manager.repository.pension.YrNursingCostHistoryRepository;
import com.yiren.manager.repository.pension.YrNursingCostRepository;
import com.yiren.manager.service.iface.pension.YrNursingCostService;

@Service("yrNursingCostService")
public class YrNursingCostServiceImpl extends GenericServiceImpl<YrNursingCost, String> implements YrNursingCostService{

	@Autowired
	private YrNursingCostHistoryRepository yrNursingCostHistoryRepository;
	
	@Autowired
	public YrNursingCostServiceImpl(YrNursingCostRepository repository) {
		super(repository);
	}

	@Transactional
	public void addByFavorites(Favorites entitys) throws MyException {
		YrNursingCost yrNursingCost = entitys.getFavorite(YrNursingCost.class);
		YrNursingCostHistory yrBedCostHistory = entitys.getFavorite(YrNursingCostHistory.class);
	
		this.repository.save(yrNursingCost);
		yrNursingCostHistoryRepository.save(yrBedCostHistory);
	}

	public void modifyByFavorites(Favorites entitys) throws MyException {
		
	}

}
